<template>
    <div class="box">
        <div class="case">
            <div class="case-top">
                <div class="horn">
                    <div class="horn-van">
                        <span class="iconfont icon-laba col"></span>
                        <span class="col">拼单上线啦！和朋友一起喝跟划算，低至五折~</span>
                        <span class="col col-vv">v</span>
                    </div>
                </div>
                <div id="text">
                    <span :class="{gai:curride==0}" id="sp1" @click="show(0)">经典菜单</span>
                    <span :class="{gai:curride==1}" id="sp2" @click="show(1)">瑞纳冰季</span>
                </div>
            </div> 
        </div>
        <component :is="com"></component>
    </div>
</template>
<script>
import Pubuliu from "./pubuliu.vue";
import Xeuxiang from "./xeuxiang.vue"
export default {
    name:'Menubar', 
    components:{
        Pubuliu,Xeuxiang
    },
    data(){
        return {
            com:Xeuxiang,
            coms:[Xeuxiang,Pubuliu],
            curride:0
        }
    },
    methods:{
        show(index){
            this.curride = index;
            this.com = this.coms[index]
        }
    },
    mounted(){
        var oTxt = document.querySelector('#text');
        window.onscroll = function(){
            var oTop = document.body.scrollTop || document.documentElement.scrollTop
            if(oTop>=114){
                oTxt.className = 'fixd';
            }else{
                oTxt.className = ''
            }
        }
    }

};

        

</script>
<style scoped>
@import url("../assets/font-footer/iconfont.css");
    .case{
        width: 3.6rem;
        
        background-color: #f6f6f4;
        position: relative;
        top: -0.05rem;
        border-top-left-radius: 0.05rem;
        border-top-right-radius: 0.05rem;
        overflow: hidden;
    }
    .case .case-top{
        width: 100%;
        height: 0.76rem;
        background-color: #fff;
        border-top-left-radius: 0.05rem;
        border-top-right-radius: 0.05rem;
        margin-bottom: 0.05rem;
    }
    .case-top .horn{
        width: 3.4rem;
        height: 0.32rem;
        margin: auto;
        padding-top: 0.08rem;
        padding-bottom: 0.12rem;
    }
    .horn .horn-van{
        width: 100%;
        height: 100%;
        background-color: #faf6eb;
        line-height: 0.32rem;
        text-align: center;
    }
    .horn-van .col{
        font-size: 0.12rem;
        color: #ee4508;
    }
    .horn-van .icon-laba{
        margin-right: 0.08rem;
    }
    .horn-van .col-vv{
        margin-left: 0.5rem;
    }
    .case-top #text{
        width: 3.6rem;
        height: 0.24rem;
        background-color: #fff;
    }
    .case-top .fixd{
        position: fixed;
        top: 0;
        left: 0;
    }
    #text #sp1,#text #sp2{
        font-size: 0.15rem;
        margin: 0 0.3rem;
        position: relative;
    }
    #text .gai{
        color: #0f1375;
        font-weight: 600;
    }
    #text .gai::after{
        content: "";
        display: block;
        width: 0.6rem;
        height: 0.03rem;
        background-color: #0f1375;
        position: absolute;
        bottom: -0.03rem;
        left: 0;
    }
    
</style>